<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="/huoyun" prefix="huoyun" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>修改车辆信息</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/theme/css/main.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/theme/css/style_userCenter.css">

<script type="text/javascript">
	function add_event(e){
		e.onmouseover = function(){
			e.className += ' hover';
		};
		e.onmouseout = function(){
			e.className = e.className.replace(' hover', '');
			e.className = e.className.replace(' active', '');
		};
		e.onmousedown = function(){
			e.className = e.className.replace(' hover', ' active');
		};
		e.onmouseup = function(){
			e.className = e.className.replace(' active', ' hover');
		};
	}

	window.onload = function(){
		var button = document.getElementById('submit_button');
		add_event(button);
	}		
</script>

<script type="text/javascript" src="${pageContext.request.contextPath}/theme/js/calendar/WdatePicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/theme/js/jquery-1.6.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/theme/js/jquery.validate.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/theme/js/additional-methods.js"></script>

<!-- 
	<script type="text/javascript" src="${pageContext.request.contextPath}/car/js/register-car-tzh.js"></script>
 -->
 
<script type="text/javascript">
	function preDiv() {
		if (!$("#regCarForm div:eq(1)").is(":hidden")) {
			$("#regCarForm div:eq(1)").hide();
			$("#regCarForm div:eq(0)").show();
			return true;
		}
		if (!$("#regCarForm div:eq(2)").is(":hidden")) {
			$("#regCarForm div:eq(2)").hide();
			$("#regCarForm div:eq(1)").show();
			return true;
		}
		if (!$("#regCarForm div:eq(3)").is(":hidden")) {
			$("#regCarForm div:eq(3)").hide();
			$("#regCarForm div:eq(2)").show();
			$("#button_submit").hide();
			return true;
		}
	}
	function nextDiv() {
		if (!$("#regCarForm div:eq(0)").is(":hidden")) {
			$("#regCarForm div:eq(0)").hide();
			$("#regCarForm div:eq(1)").show();
			return true;
		}
		if (!$("#regCarForm div:eq(1)").is(":hidden")) {
			$("#regCarForm div:eq(1)").hide();
			$("#regCarForm div:eq(2)").show();
			return true;
		}
		if (!$("#regCarForm div:eq(2)").is(":hidden")) {
			$("#regCarForm div:eq(2)").hide();
			$("#regCarForm div:eq(3)").show();
			$("#button_submit").show();
			return true;
		}
	}
</script>

<script type="text/javascript">
	  $(document).ready(function(){
	  	$("#regCarForm").validate({
	  	errorPlacement: function(error, element) {
			// element.parent("td").append(error);
				element.attr("title", error.html());
			},
	  	rules : {
	  		"car.driverId" : {
	  			required : true,
	  			isValid : true
	  		},
	  		"car.type":{
	  			required : true,
	  			isValid : true
	  		},
	  		"car.loadMax":{
	  			required : true,
	  			number: true
	  		},
	  		"car.length":{
	  			required : true,
	  			number: true
	  		},
	  		"car.width":{
	  			required : true,
	  			number: true
	  		},
	  		"car.height":{
	  			required : true,
	  			number: true
	  		},
	  		"cardNumber1":{
	  			required : true
	  		},
	  		"cardNumber2":{
	  			required : true
	  		},
	  		"cardNumber3":{
	  			required : true,
	  			carNumber5 : true
	  		},
	  		"car.engineNumber":{
	  			required : true
	  		},
	  		"car.carIDCode":{
	  			required : true
	  		},
	  		"car.owner":{
	  			required : true
	  		},
	  		"car.registrationDate":{
	  			date1: true
	  		},
	  		"car.issueDate":{
	  			date1: true
	  		}
	  	},
	  	messages : {
	  		"car.driverId" : {
	  			required : "请选择司机",
	  			isValid : "请选择司机2"
	  		},
	  		"car.type":{
	  			required : "请选择车辆类型信息",
	  			isValid : "请选择车辆类型信息"
	  		},
	  		"car.loadMax":{
	  			required : "请输入额定载重量",
	  			number: "请输入合法的数字"
	  		},
	  		"car.length":{
	  			required : "请输入车辆的长度",
	  			number: "请输入合法的长度数值"
	  		},
	  		"car.width":{
	  			required : "请输入车辆的宽度",
	  			number: "请输入合法的宽度数值"
	  		},
	  		"car.height":{
	  			required : "请输入车辆的高度",
	  			number: "请输入合法的高度数值"
	  		},
	  		"cardNumber1":{
	  			required : "请选择车牌号所属区域"
	  		},
	  		"cardNumber2":{
	  			required : "请选择车牌号所属区域"
	  		},
	  		"cardNumber3":{
	  			required : "请输入车牌号",
	  			carNumber5 : "请填写正确的车牌号"
	  		},
	  		"car.engineNumber":{
	  			required : "请输入发动机号码"
	  		},
	  		"car.carIDCode":{
	  			required : "请输入车辆识别代号"
	  		},
	  		"car.owner":{
	  			required : "请输入车辆归属人"
	  		},
	  		"car.registrationDate":{
	  			date1: "请输入合法的注册日期"
	  		},
	  		"car.issueDate":{
	  			date1: "请输入合法的发证日期"
	  		}
	  	}
	  	});
	  });
  </script>
 
</head>

<body>
	<div>
		<jsp:include page="../userAdmin/nav.jsp">
			<jsp:param value="nav_main" name="nav" />
		</jsp:include>
	</div>
	<div class="realCer">
		<!--主体部分-->
		<div class="realMain clearfix mt10">
			<!--左侧菜单-->
			<div class="realLeft" id="meunLeft">
				<jsp:include page="../userAdmin/leftMenu.jsp">
					<jsp:param value="con_nav_main" name="con_nav" />
				</jsp:include>
			</div>
			<!--中间-->
			<div class="realRight ml10">
				<!--中间-->
				<div class="realR_left">
					<div class="box">
						<div class="tit">
							<strong>修改车辆信息</strong>
						</div>
						<div class="con">
							<div style="color: red; margin-left: 100px;">
								<s:property value="resultMsg" />
								<s:fielderror></s:fielderror>
							</div>
							<div class="form_wrap clearfix">
								<form method="post" id="regCarForm" name="regCarForm"
									action="/huoyun/car/updateRegistedCar.action?carId=<%=request.getParameter("carId")%>">
									<strong><font size="4px"><span
											class="required-field">注意：</span>加<span class="required-field">*</span>号项为必填项！</font>
									</strong> <br>
									<br>

									<!-- 车辆基本信息 -->
									<div class="form_wrap clearfix">
										<table class="tableForm registerCar">
										<tbody>
											<tr>
												<td colspan="2" >
													<h2>司机信息</h2>
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													<span class="required-field">*</span>司机：
												</td>
												<td class="tdValue">
													<s:select id="driver_select" name="car.driverId"
														list="driverList" listKey="id" listValue="name"
														headerKey="-1" headerValue="请选择" emptyOption="false"
														multiple="false" theme="simple">
													</s:select>
													<a class="add" href="javascript:;" onclick="openDialog();">添加司机</a>
												</td>
											</tr>
											<tr>
												<td colspan="2" >
													<h2>车辆基本信息</h2>
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="120">
													<span class="required-field">*</span>车辆类型：
												</td>
												<td class="tdValue">
													<huoyun:customSelect mode="carRequiredType" name="car.type" id="car.type" value="${car.type }"/>
													<%-- <s:select id="car.type" name="car.type"
														list="#{'普通车辆':'普通车辆',
															    '平板车辆':'平板车辆',
															    '冷藏车辆':'冷藏车辆',
															    '半挂车辆':'半挂车辆',
															    '前四后八':'前四后八',
															    '集装箱车':'集装箱车',
															    '箱式车辆':'箱式车辆',
															    '半封车辆':'半封车辆',
															    '保温车辆':'保温车辆',
															    '双桥车辆':'双桥车辆',
															    '单桥车辆':'单桥车辆',
															    '高栏车辆':'高栏车辆',
															    '低栏车辆':'低栏车辆',
															    '棚车':'棚车',
															    '其他车辆':'其他车辆'}" 
														value="car.type"
														headerKey="-1" emptyOption="false"
														multiple="false" theme="simple">
													</s:select> --%>
													<%-- <select name="car.type" id="car.type" class="car.type">
													<option value="普通车辆">普通车辆</option>
													<option value="平板车辆">平板车辆</option>
													<option value="冷藏车辆">冷藏车辆</option>
													<option value="半挂车辆">半挂车辆</option>
													<option value="前四后八">前四后八</option>
													<option value="集装箱车">集装箱车</option>
													<option value="箱式车辆">箱式车辆</option>
													<option value="半封车辆">半封车辆</option>
													<option value="保温车辆">保温车辆</option>
													<option value="双桥车辆">双桥车辆</option>
													<option value="单桥车辆">单桥车辆</option>
													<option value="高栏车辆">高栏车辆</option>
													<option value="低栏车辆">低栏车辆</option>
													<option value="棚车">棚车</option>
													<option value="其他车辆">其他车辆</option>
												</select> --%>
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													<span class="required-field">*</span>额定载重量：
												</td>
												<td class="tdValue">
													<s:textfield theme="simple" name="car.loadMax" id="car.loadMax" style="width:60px;" class="inputtext" />&nbsp;吨
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													<span class="required-field">*</span>车厢规格：
												</td>
												<td class="tdValue">
													<s:textfield theme="simple" name="car.length" id="car.length"
														class="inputtext" style="WIDTH:60px" />
													<label for="car.length">长(m)×</label>
													<s:textfield theme="simple" name="car.width" id="car.width"
														class="inputtext" style="WIDTH:60px" />
													<label for="car.width">宽(m)×</label>
													<s:textfield theme="simple" name="car.height" id="car.height"
														class="inputtext" style="WIDTH:60px" />
													<label for="car.height">高(m)</label>
												</td>
											</tr>
											<tr>
												<td colspan="2" >
													<h2>车辆行驶证信息</h2>
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													<span class="required-field">*</span>车牌号：
												</td>
												<td class="tdValue">
													<!-- <input type="text" name="car.cardNumber" id="cardNumber"
													class="inputtext"/> -->
													<s:select id="cardNumber1" name="cardNumber1" style="width:50px;"
														list="#{'京':'京',
															   '津':'津',
															   '渝':'渝',
															   '沪':'沪',
															   '冀':'冀',
															   '豫':'豫',
															   '云':'云',
															   '辽':'辽',
															   '黑':'黑',
															   '湘':'湘',
															   '皖':'皖',
															   '鲁':'鲁',
															   '新':'新',
															   '苏':'苏',
															   '浙':'浙',
															   '赣':'赣',
															   '鄂':'鄂',
															   '桂':'桂',
															   '甘':'甘',
															   '晋':'晋',
															   '蒙':'蒙',
															   '陕':'陕',
															   '吉':'吉',
															   '闽':'闽',
															   '贵':'贵',
															   '粤':'粤',
															   '川':'川',
															   '青':'青',
															   '藏':'藏',
															   '宁':'宁',
															   '琼':'琼'}" 
														value="cardNumber1"
														headerKey="-1" emptyOption="false"
														multiple="false" theme="simple" style="width:50px;">
													</s:select>
													<s:select name="cardNumber2" id="cardNumber2" style="width:45px;"
														list="#{'A':'A',
																'B':'B',
																'C':'C',
																'D':'D',
																'E':'E',
																'F':'F',
																'G':'G',
																'H':'H',
																'I':'I',
																'J':'J',
																'K':'K',
																'L':'L',
																'M':'M',
																'N':'N',
																'O':'O',
																'P':'P',
																'Q':'Q',
																'R':'R',
																'S':'S',
																'T':'T',
																'U':'U',
																'V':'V',
																'W':'W',
																'X':'X',
																'Y':'Y',
																'Z':'Z'}"
															value="cardNumber2" 
														headerKey="-1" emptyOption="false"
														multiple="false" theme="simple" style="width:45px;">
													</s:select>
													<s:textfield theme="simple" maxlength="5" name="cardNumber3" id="cardNumber3" style="width:45px;text-transform:uppercase"/>
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													<span class="required-field">*</span>发动机号码：
												</td>
												<td class="tdValue">
													<s:textfield theme="simple" name="car.engineNumber"
													id="car.engineNumber" class="inputtext" />
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													<span class="required-field">*</span>车辆识别代号：
												</td>
												<td class="tdValue">
													<s:textfield theme="simple" name="car.carIDCode" id="car.carIDCode"
													class="inputtext" />
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													车辆品牌：
												</td>
												<td class="tdValue">
													<s:textfield theme="simple" name="car.brand" id="car.brand"
													class="inputtext" />
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													车辆行驶证地址：
												</td>
												<td class="tdValue">
													<s:textfield theme="simple" name="car.address" id="car.address"
													class="inputtext" />
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													<span class="required-field">*</span>车辆归属人：
												</td>
												<td class="tdValue">
													<s:textfield theme="simple" name="car.owner" id="car.owner"
														class="inputtext" />
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													车辆行驶证注册日期：
												</td>
												<td class="tdValue">
													<s:textfield theme="simple" name="car.registrationDate"
													id="car.registrationDate" class="Wdate"
													onClick="WdatePicker({dateFmt:'yyyy-MM-dd'});" />
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
													车辆行驶证发证日期：
												</td>
												<td class="tdValue">
													<s:textfield theme="simple" name="car.issueDate" id="car.issueDate"
													class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'});" />
												</td>
											</tr>
											<tr>
												<td class="tdLabel" width="100">
												</td>
												<td class="tdValue">
													<input type="submit" id="submit_button"
													class="default_btn" value="修改" />
													<input type="button" class="default_btn" value="删除" onclick="if(confirm('确定要删除车辆信息吗？')){this.form.action='/huoyun/car/deleteCar.action?carId=<%=request.getParameter("carId")%>'; this.form.submit();}"/>
													<!-- <input type="button" id="submit_button"
													class="default_btn" value="注 册" onclick="submit_form();"/> -->
												</td>
											</tr>
										</tbody>
										</table>
									</div>
									<!-- 车辆基本信息结束 -->
									
									<script type="text/javascript">
									var $driver_select = $("#driver_select");
									var dialog;
									function openDialog()
									{
										$.ajax({
											type : "post",
											url : "car/preAddDriver.action",
											data : {
											},
											dataType : "html",
											success : function(data) {
												dialog = new Dialog({type:'html',value:data}, {title:'添加司机信息'}, {fixed:false});
												dialog.show();
											}
										});
										
									}
									/* function submit_form() {
										$('#cardNumber').val($('#cardNumber1').val() + $('#cardNumber2').val() + $('#cardNumber3').val());
										alert($('#cardNumber').val());
									} */
									</script>
								</form>
							</div>
						</div>
					</div>
				</div>
				<!-- 中间 -->
				<!--右侧-->
				<div class="realR_right">
					<div class="box mb10">
						<div class="tit">雇主说</div>
						<div class="con">44444444444444</div>
					</div>
				</div>
				<!--右侧-->
			</div>
			<!--中由-->
		</div>
	</div>
	<div>
		<jsp:include page="../footer.jsp"></jsp:include>
	</div>
</body>
</html>
